ruby:
  colspan = cols.length + 1
  colspan += 1 if ordered
  colspan += 1 if has_thumb
  colspan -= 1 if hide_delete_button
  table_class = ordered ? 'js-sort-row' : nil

  options_for_td = { cols: cols, edit_path: edit_path, edit_column: edit_column }

table class=table_class
  thead
    tr
      - if ordered
        th.th-sortable-handle
      - if has_thumb
        th.-thumb
      - cols.each do |col|
        = th_columns(col)
      - if edit_column
        th.-action data-sorter="false"
      - unless hide_delete_button
        th.-action
  tbody
    - records = index ? @items : parent_item.send(assoc)
    - if records.present?
      - records.each do |item|
        tr id=tr_id(item)
          - if ordered
            td.sortable-handle: i.icon-sort
          - if has_thumb
            td = image_tag(item.asset.thumb.url)
          - cols.each do |col|
            - options_for_td[:col] = col
            - options_for_td[:item] = item
            = td_columns(options_for_td)
          - if edit_column
            td
              a.js-edit-link.js-tooltip.table-action title=t('fae.common.edit') href=self.send(edit_path, item)
                i.icon-edit
          - unless hide_delete_button
            td = fae_delete_button item, "/#{fae_path}/#{assoc_name}/#{item.id.to_s}", class: 'js-tooltip table-action js-delete-link', remote: true

    - elsif !hide_add_button
      tr
        - td_link = link_to 'add some', new_path, class: 'js-add-link'

        td colspan=colspan.to_s No #{title} yet, #{td_link}.
    - else
      tr
        td colspan=colspan.to_s No #{title} yet.

.js-addedit-form-wrapper
